package com.hushow.plugin.brick.service;


import org.springframework.context.annotation.DependsOn;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

@Service
@DependsOn("pluginManager")
public class ExtensionPointService {

    @Resource
    List<IDemoExtensionPoint<?>> iDemoExtensionPoints;

    public List<Object> getByIds(String id){

        if(CollectionUtils.isEmpty(iDemoExtensionPoints)){
            throw new RuntimeException("iDemoExtensionPoints is empty");
        }

        List<Object> objectList = new ArrayList<>();
        iDemoExtensionPoints.forEach(iDemoExtensionPoint -> {
            objectList.add(iDemoExtensionPoint.getById(id));
        });

        return objectList;
    }
}
